#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int panduan(char a)
{
    if(a==' '||a==','||a=='.'||a=='?'||a=='!')
        return -1;
    else
        return 0;
}
int main()
{
    char a[100];
    gets(a);
    int i=0,first,last;
    while(a[i]!='\0')
    {
        int first=i;
        int last=i;
        while(panduan(a[last])!=-1&&a[last]!='\0')
        {
            last++;
            i++;
        }
        for(int j=last-1;j>=first;j--)
        {
            putchar(a[j]);
        }
        if(a[i]=='\0')
            break;
        else
            putchar(a[i++]);
    }
    return 0;
}
